package com.qupeng.demo.kafka.kafkaspringbootstreams.dashboard.kafka.consumer;

import com.qupeng.demo.kafka.kafkaspringbootstreams.dashboard.model.AgentProfile;
import com.qupeng.demo.kafka.kafkaspringbootstreams.dashboard.model.AgentStatistic;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class AgentStatisticsListener {

    @KafkaListener(id = "agent-statistics-listener",
            groupId = "agentStatisticGroup",
            topics = "agent-statistics",
            clientIdPrefix = "agent-statistics",
            properties = {}
    )
    public void listen(ConsumerRecord<String, AgentStatistic> consumerRecord) {
        System.out.println(consumerRecord);
        System.out.println(consumerRecord.value());
    }
//    public void listen(ConsumerRecords<Integer, AgentStatistic> agentStatisticRecords) {
//        for (ConsumerRecord<Integer, AgentStatistic> agentStatisticRecord : agentStatisticRecords) {
//            System.out.println(agentStatisticRecord.value());
//        }
//    }
}
